package com.colin.aiyi.ui;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;

import com.colin.aiyi.R;
import com.colin.aiyi.entity.User;
import com.colin.aiyi.ui.Home.MainActivity;
import com.colin.aiyi.utils.SharePreferenceUtil;

import java.util.Timer;
import java.util.TimerTask;

/**
 * Created by hl on 2017/6/22.
 */

public class BeginAc extends BaseActivity {
    boolean isFrist=true;
    private int startType=1;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.ac_begin);
        user=getUser();
        startActivity(new Intent(this,TestAc.class));
        if (true)
        return;

        TimerTask task = new TimerTask()
        {
            public void run()
            {
                checkFrist();
            }
        };
        Timer timer = new Timer();
        timer.schedule(task,200);
    }



    private void checkFrist(){
        Intent intent=new Intent(this,MainActivity.class);
        isFrist=SharePreferenceUtil.getBoolean(this,"isFrist",true);
        if (isFrist){
            startType=0;
            SharePreferenceUtil.setValue(this,"isFrist",false);
        }
        switch (startType){
            case 0:
               intent=new Intent(this,GuideAc.class);
                break;
            case 1:
                break;
        }
        if (SharePreferenceUtil.getObject(this, User.class) == null) {
            SharePreferenceUtil.saveObject(this, User.getInstance());
        }
        startActivity(intent);
        finish();
    }

}
